package com.bw.tap.adapter;

import androidx.databinding.DataBindingUtil;

import com.bw.tap.R;
import com.bw.tap.bean.Community;
import com.bw.tap.bean.CommunityDataUI;
import com.bw.tap.databinding.ItemCommunityBinding;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public
class CommunityAdapter extends BaseQuickAdapter<Community, BaseViewHolder> {


    public CommunityAdapter() {
        super(R.layout.item_community);
    }

    @Override
    public void onBindViewHolder(@NotNull BaseViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        DataBindingUtil.bind(holder.itemView);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, Community community) {
        ItemCommunityBinding binding = DataBindingUtil.getBinding(baseViewHolder.itemView);
        //只操作数据

        binding.setCommunity(new CommunityDataUI(community));
    }
}
